﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Forget.HRBLL.View;
using Forget.HRBLL.Logical;

namespace HRWebSite.Employee
{
    public partial class EditSalary : BasePage
    {
        protected override void Page_Load(object sender, EventArgs e)
        {
            this.HRLimitAttribute = Forget.HRBLL.LimitAttribute.Read | Forget.HRBLL.LimitAttribute.Modify;
            this.HRLimits = Limits.EmployeeManage;
            base.Page_Load(sender, e);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            List<EmployeeSalary> eSalaries = new List<EmployeeSalary>();
            foreach (GridViewRow row in this.GridView1.Rows)
            {
                EmployeeSalary eSalary = new EmployeeSalary();
                eSalary.NumberID = row.Cells[0].Text;
                eSalary.Salary = double.Parse(((TextBox)row.Cells[3].Controls[1]).Text);
                eSalaries.Add(eSalary);
            }
            if(EmployeeLogical.Modify_Salary(eSalaries))
                Response.Write("<script>alert('保存成功');</script>");
            else
                Response.Write("<script>alert('保存失败');</script>");
        }
    }
}